package View.Message;

import com.sun.jdi.event.ThreadStartEvent;
import domain.User;
import domain.systemMsg;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class LookMsg extends JFrame {

    public LookMsg(systemMsg msg,User user){
        init();
        componentInit(msg,user);
    }

    public void init(){
        this.setTitle("详细详情");
        this.setSize(800,500);
        this.setResizable(true);
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setLayout(null);
    }

    public void componentInit(systemMsg msg,User user){


        JTextArea area = new JTextArea(msg.getNeirong());
        area.setBounds(200, 5, 450,300);
        area.setFont(new Font("宋体", Font.PLAIN, 15));
        area.setEnabled(false);

        JButton button = new JButton("返回");
        button.setBounds(400,400,95,27);
        this.add(area);
        this.add(button);

        button.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                dispose();
            }
        });
    }
}
